{% extends "base.html" %}

{% block title %}预测结果 - 人才流失预测系统{% endblock %}

{% block content %}
<div class="row">
    <div class="col-12">
        <h1 class="text-center mb-4">预测结果</h1>
    </div>
</div>

<div class="row justify-content-center">
    <div class="col-md-8">
        <div class="prediction-result {% if result.prediction == 1 %}high-risk{% else %}low-risk{% endif %}">
            <h3 class="text-center">
                {% if result.prediction == 1 %}
                <span class="badge bg-danger">高风险</span>
                {% else %}
                <span class="badge bg-success">低风险</span>
                {% endif %}
            </h3>
            <p class="text-center fs-5">{{ result.message }}</p>
            
            <div class="row mt-4">
                <div class="col-md-6">
                    <p><strong>预测结果:</strong> {{ result.prediction }}</p>
                    <p><strong>流失概率:</strong> {{ "%.2f"|format(result.probability * 100) }}%</p>
                </div>
                <div class="col-md-6">
                    <p><strong>判断阈值:</strong> {{ result.threshold }}</p>
                    <p><strong>风险等级:</strong> 
                        {% if result.probability >= 0.7 %}
                            极高风险
                        {% elif result.probability >= 0.5 %}
                            高风险
                        {% elif result.probability >= 0.3 %}
                            中等风险
                        {% else %}
                            低风险
                        {% endif %}
                    </p>
                </div>
            </div>
        </div>
        
        <div class="mt-4 text-center">
            <a href="/" class="btn btn-primary">重新预测</a>
            <a href="/api/docs" class="btn btn-secondary">查看API文档</a>
        </div>
    </div>
</div>
{% endblock %}
